package com.ruoyi.system.service.module.product.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.exception.TransactionalException;
import com.ruoyi.common.exception.YshopException;
import com.ruoyi.common.utils.QRCodeUtilEx;
import com.ruoyi.common.utils.RegexUtil;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.system.domain.module.dto.DetailDto;
import com.ruoyi.system.domain.module.dto.FromatDetailDto;
import com.ruoyi.system.domain.module.dto.ProductFormatDto;
import com.ruoyi.system.domain.module.dto.ProductResultDto;
import com.ruoyi.system.domain.module.mer.Mer;
import com.ruoyi.system.domain.module.platform.PlatformSplit;
import com.ruoyi.system.domain.module.product.*;
import com.ruoyi.system.mapper.module.estate.EstateMapper;
import com.ruoyi.system.mapper.module.mer.MerCouponProductMapper;
import com.ruoyi.system.mapper.module.mer.MerMapper;
import com.ruoyi.system.mapper.module.platform.PlatformSplitMapper;
import com.ruoyi.system.mapper.module.product.ProductEstateMapper;
import com.ruoyi.system.mapper.module.product.ProductImgMapper;
import com.ruoyi.system.mapper.module.product.ProductMapper;
import com.ruoyi.system.mapper.module.product.ProductTypeMapper;
import com.ruoyi.system.service.module.product.IProductAttrService;
import com.ruoyi.system.service.module.product.IProductAttrValueService;
import com.ruoyi.system.service.module.product.IProductRuleService;
import com.ruoyi.system.service.module.product.IProductService;
import com.ruoyi.system.service.system.ISysDictDataService;
import com.vdurmont.emoji.EmojiParser;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;

/**
 * 商品Service业务层处理
 *
 * @author ruoyi
 * @date 2021-08-11
 */
@Service
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements IProductService {

	@Resource
	private IProductAttrValueService productAttrValueService;
	@Resource
	private IProductAttrService productAttrService;
	@Resource
	private ProductMapper productMapper;
	@Resource
	private ProductImgMapper productImgMapper;
	@Resource
	private IProductRuleService productRuleService;
	@Resource
	private PlatformSplitMapper platformSplitMapper;
	@Resource
	private ISysDictDataService sysDictDataService;
	@Resource
	private ProductEstateMapper productEstateMapper;
	@Resource
	private EstateMapper estateMapper;
	@Resource
	private MerCouponProductMapper merCouponProductMapper;
	@Resource
	private MerMapper merMapper;
	@Resource
	private ProductTypeMapper productTypeMapper;

	@Value("${ruoyi.profile}")
	private String uploadPath;

	@Value("${ruoyi.imgUrl}")
	private String imgUrl;

//	@Value("${ruoyi.imgUrlOss}")
//	private String imgUrlOss;

	@Override
	@Transactional
	public int addProduct(Product product) throws TransactionalException {
		try{
			if(StrUtil.isNotEmpty(product.getDescription())){
				String content = EmojiParser.parseToAliases(product.getDescription());
				product.setDescription(RegexUtil.convertProductDescription(content));
			}

			if(StrUtil.isNotEmpty(product.getBuyingTips())){
				String buyTips = EmojiParser.parseToAliases(product.getBuyingTips());
				product.setBuyingTips(RegexUtil.convertProductDescription(buyTips));
			}

			//添加商品
			Product yxStoreProduct = new Product();
			BeanUtil.copyProperties(product, yxStoreProduct, "sliderImage");
			if (product.getSliderImage() == null || product.getSliderImage().isEmpty()) {
//				throw new YshopException("请上传轮播图");
				return -1;
			}

			yxStoreProduct.setSliderImage(String.join(",", product.getSliderImage()));

			if(product.getIsSale() == 1){
				ProductResultDto resultDTO = this.computedProduct(product.getAttrs());
				yxStoreProduct.setPrice(BigDecimal.valueOf(resultDTO.getMinPrice()));
				yxStoreProduct.setOtPrice(BigDecimal.valueOf(resultDTO.getMinOtPrice()));
				yxStoreProduct.setCost(BigDecimal.valueOf(resultDTO.getMinCost()));
				yxStoreProduct.setStock(resultDTO.getStock());
			}

			if (product.getId() != null) {
				//清空商品转发图
				deleteForwardImg(product.getId());
			}

			boolean bl = this.saveOrUpdate(yxStoreProduct);
			if(bl){
				QueryWrapper<ProductImg> qwImg = new QueryWrapper<>();
				qwImg.eq("product_id",yxStoreProduct.getId());
				qwImg.eq("img_type", 0);
				ProductImg proImg = productImgMapper.selectOne(qwImg);
				if(proImg!=null){
					if(CollUtil.isNotEmpty(product.getProductImgs())){
						if(product.getProductImgs().size() > 0) {
							proImg.setImgUrl(product.getProductImgs().get(0).getImgUrl());
							productImgMapper.updateById(proImg);
						}
					}
				}else{
					if(CollUtil.isNotEmpty(product.getProductImgs())){
						if(product.getProductImgs().size() > 0){
							proImg = new ProductImg();
							proImg.setProductId(yxStoreProduct.getId());
							proImg.setImgUrl(product.getProductImgs().get(0).getImgUrl());
							proImg.setSort(0);
							proImg.setImgType(0);
							productImgMapper.insert(proImg);
						}
					}
				}


				List<ProductImg> delImg = new ArrayList<>();
				List<ProductImg> imgs = product.getProductImgLunbos();

				QueryWrapper<ProductImg> qw = new QueryWrapper<>();
				qw.eq("product_id",yxStoreProduct.getId());
				qw.eq("img_type", 1);
				List<ProductImg> productImgs = productImgMapper.selectList(qw);
				if(CollUtil.isNotEmpty(productImgs)){
					for (ProductImg img : productImgs){
						int isHas = 0;
						for (ProductImg img1 : imgs){
							if (img1.getId() != null && img.getId().equals(img1.getId())) {//存在
								isHas = 1;
								break;
							}
						}
						if(isHas == 0){
							delImg.add(img);
						}
					}
				}

				if(CollUtil.isNotEmpty(imgs)){
					for (ProductImg img : imgs){
						if(img.getId() == null){
							img.setProductId(yxStoreProduct.getId());
							img.setSort(1);
							img.setImgType(1);
							productImgMapper.insert(img);
						}
					}
				}
				if(CollUtil.isNotEmpty(delImg)){
					for (ProductImg img : delImg){
						productImgMapper.deleteById(img.getId());
					}
				}

				if(StrUtil.isEmpty(yxStoreProduct.getProductNo())){
					String no = String.valueOf(2200000 + yxStoreProduct.getId());
					yxStoreProduct.setProductNo(no);
				}

				if(StrUtil.isEmpty(yxStoreProduct.getQrCode())){
					String qrCode = "";
					String fileName = "product_qr_" + yxStoreProduct.getId() + ".jpg";
					String content = "https://www.caihengyun.com/wxmini/product/detail?id=" + yxStoreProduct.getId();
					int upload_type = FileUploadUtils.TYPE_PRODUCT_QRCODE;
					System.out.println("content:  "+ content);
					String img_key = "";
					img_key = FileUploadUtils.getUploadPrefix(upload_type) + fileName;
					QRCodeUtilEx.createQrCodeImg(content, "No." + yxStoreProduct.getProductNo(),
						null, uploadPath + "/" + img_key, true, fileName, upload_type);
					qrCode = img_key;
					yxStoreProduct.setQrCode(qrCode);

					int ret = productMapper.updateById(yxStoreProduct);
					if(ret <= 0){
						throw new TransactionalException("二维码生成失败");
					}
				}
			}

			if(product.getIsSale() == 1) {
				//属性处理
				//处理单sKu
				if (product.getSpecType() == 0) {// 单规格
					FromatDetailDto fromatDetailDto = FromatDetailDto.builder()
							.value("规格").detailValue("")
							.attrHidden("")
							.detail(ListUtil.toList("默认"))
							.build();
					List<ProductFormatDto> attrs = product.getAttrs();
					ProductFormatDto productFormatDto = attrs.get(0);
					productFormatDto.setValue1("规格");
					Map<String, String> map = new HashMap<>();
					map.put("规格", "默认");
					productFormatDto.setDetail(map);
					productAttrService.insertProductAttr(ListUtil.toList(fromatDetailDto), ListUtil.toList(productFormatDto), yxStoreProduct.getId());
				} else {
					//多规格的 去掉默认规格的
					QueryWrapper<ProductAttr> qw = new QueryWrapper<>();
					qw.eq("product_id",yxStoreProduct.getId());
					qw.eq("attr_name", "规格");
					qw.eq("attr_values", "默认");
					ProductAttr productAttr = productAttrService.getOne(qw);
					if(productAttr != null){
						productAttrService.removeById(productAttr.getId());
					}
					//多规格
					productAttrService.insertProductAttr(product.getItems(), product.getAttrs(), yxStoreProduct.getId());
				}
			}
		}catch (Exception e){
			e.printStackTrace();
			throw new TransactionalException("addProduct system erro");
		}
		return 1;
	}

	/**
	 * 商品详情
	 *
	 * @param id        商品id
	 * @return ProductVo
	 */
	@Override
	public Product goodsDetail(Long id) {
		LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>();
		wrapper.eq(Product::getId, id);
		Product product = productMapper.selectOne(wrapper);
		if (ObjectUtil.isNull(product)) {
			return null;
		}


		if(StrUtil.isNotEmpty(product.getImage())){
			if(product.getImage().indexOf("https") < 0){
				product.setImagePath(imgUrl + product.getImage());
			}else{
				product.setImagePath(product.getImage());
			}
		}else{
			product.setImagePath("");
		}


		List<String> sliderImageArray = new ArrayList<>();
		String sliderImgs = "";
		product.setSliderImageArray(sliderImageArray);
		if(StrUtil.isNotEmpty(product.getSliderImage())){
			String[] sliderImages = product.getSliderImage().split(",");
			for (String img: sliderImages){
				if(img.indexOf("https") < 0){
					sliderImageArray.add(imgUrl + img);
					sliderImgs += imgUrl + img + ",";
				}else{
					sliderImageArray.add(img);
					sliderImgs += img + ",";
				}
			}
			if(sliderImgs.length() > 0){
				sliderImgs = sliderImgs.substring(0,sliderImgs.length() - 1);
			}
			product.setSliderImagePath(sliderImgs);
			product.setSliderImageArray(sliderImageArray);
		}

		if(StrUtil.isNotEmpty(product.getDescription())){
			product.setDescription(EmojiParser.parseToUnicode(product.getDescription()));
		}

		if(StrUtil.isNotEmpty(product.getBuyingTips())){
			product.setBuyingTips(EmojiParser.parseToUnicode(product.getBuyingTips()));
		}

		//获取商品sku
		Map<String, Object> returnMap = productAttrService.getProductAttrDetail(id);

		ProductRule rule = productRuleService.getOne(new LambdaQueryWrapper<ProductRule>().eq(ProductRule::getId, product.getRuleId()));
		if(rule != null){
			if(StrUtil.isNotEmpty(rule.getRuleValue())){

				rule.setRuleValueArray(JSONUtil.parseArray(rule.getRuleValue()));
			}
		}
		product.setRule(rule);


		List<PlatformSplit> splits = platformSplitMapper.selectList(new LambdaQueryWrapper<>());
		if(CollUtil.isNotEmpty(splits)){
			for(PlatformSplit split : splits){
				SysDictData dictData = sysDictDataService.selectDictData("split_type",split.getSplitType());
				String content = "：业主：" + split.getProprietorSplit() + split.getSplitTypeUnit();
				content += ", 物业：" + split.getPropertySplit() + split.getSplitTypeUnit();
				content += "，平台：" + split.getPlatformSplit() + split.getSplitTypeUnit();
				if(dictData!=null){
					split.setSplitTypeName(dictData.getDictLabel() + content);
				}
			}
		}
		product.setSplits(splits);

		//设置商品相关信息
		product.setProductAttr((List<ProductAttr>) returnMap.get("productAttr"));
		product.setProductValue((Map<String, ProductAttrValue>) returnMap.get("productValue"));

		return product;
	}

	@Override
	public void deleteForwardImg(Long id) {
//		baseMapper.deleteForwardImg(id, "_product_detail_wap");
	}

	@Override
	public Page<Product> selectPageList(Page<Product> page, Map<String, Object> map) {
		return productMapper.selectPageList(page,map);
	}


	/**
	 * 计算产品数据
	 *
	 * @param attrs attrs
	 * @return ProductResultDto
	 */
	private ProductResultDto computedProduct(List<ProductFormatDto> attrs) {
		//取最小价格
		Double minPrice = attrs
			.stream()
			.map(ProductFormatDto::getPrice)
			.min(Comparator.naturalOrder())
			.orElse(0d);

		Double minOtPrice = attrs
			.stream()
			.map(ProductFormatDto::getOtPrice)
			.min(Comparator.naturalOrder())
			.orElse(0d);

		Double minCost = attrs
			.stream()
			.map(ProductFormatDto::getCost)
			.min(Comparator.naturalOrder())
			.orElse(0d);
		//计算库存
		Integer stock = attrs
			.stream()
			.map(ProductFormatDto::getStock)
			.reduce(Integer::sum)
			.orElse(0);

		if (stock <= 0) {
			throw new YshopException("库存不能低于0");
		}

		return ProductResultDto.builder()
			.minPrice(minPrice)
			.minOtPrice(minOtPrice)
			.minCost(minCost)
			.stock(stock)
			.build();
	}


	/**
	 * 获取生成的属性
	 *
	 * @param id      商品id
	 * @param jsonStr jsonStr
	 * @return map
	 */
	@Override
	public Map<String, Object> getFormatAttr(Long id, String jsonStr, boolean isActivity,Integer isReset) {
		JSONObject jsonObject = JSONUtil.parseObj(jsonStr);
		Map<String, Object> resultMap = new LinkedHashMap<>(3);

		if (jsonObject == null || jsonObject.get("attrs") == null || jsonObject.getJSONArray("attrs").isEmpty()) {
			resultMap.put("attr", new ArrayList<>());
			resultMap.put("value", new ArrayList<>());
			resultMap.put("header", new ArrayList<>());
			return resultMap;
		}
		try{
			List<FromatDetailDto> fromatDetailDTOList = JSONUtil.toList(jsonObject.getStr("attrs"),FromatDetailDto.class);

			//fromatDetailDTOList
			DetailDto detailDto = this.attrFormat(fromatDetailDTOList);

			List<Map<String, Object>> headerMapList = null;
			List<Map<String, Object>> valueMapList = new ArrayList<>();
			String align = "center";
			Map<String, Object> headerMap = new LinkedHashMap<>();
			for (Map<String, Map<String, String>> map : detailDto.getRes()) {
				Map<String, String> detail = map.get("detail");
				String[] detailArr = detail.values().toArray(new String[]{});
				Arrays.sort(detailArr);
				String sku = String.join(",", detailArr);
				Map<String, Object> valueMap = new LinkedHashMap<>();
				List<String> detailKeys = detail.entrySet().stream().map(Map.Entry::getKey).collect(Collectors.toList());
				int i = 0;
				headerMapList = new ArrayList<>();
				for (String title : detailKeys) {
					headerMap.put("title", title);
					headerMap.put("minWidth", "120");
					headerMap.put("align", align);
					headerMap.put("key", "value" + (i + 1));
					headerMap.put("slot", "value" + (i + 1));
					headerMapList.add(ObjectUtil.clone(headerMap));
					i++;
				}

				String[] detailValues = detail.values().toArray(new String[]{});
				for (int j = 0; j < detailValues.length; j++) {
					String key = "value" + (j + 1);
					valueMap.put(key, detailValues[j]);
				}

				valueMap.put("id", 0);
				valueMap.put("detail", detail);
//				valueMap.put("image", "");
//				valueMap.put("imagePath", "");
				valueMap.put("price", 0);
				valueMap.put("cost", 0);
				valueMap.put("otPrice", 0);
				valueMap.put("stock", 0);
//				valueMap.put("barCode", "");
//				valueMap.put("weight", 0);
//				valueMap.put("volume", 0);
//				valueMap.put("brokerage", 0);
//				valueMap.put("brokerageTwo", 0);
//				valueMap.put("pinkPrice", 0);
//				valueMap.put("pinkStock", 0);
				if (id > 0) {
					ProductAttrValue productAttrValue = productAttrValueService
						.getOne(Wrappers.<ProductAttrValue>lambdaQuery()
							.eq(ProductAttrValue::getProductId, id)
							.eq(ProductAttrValue::getSku, sku)
							.eq(ProductAttrValue::getIsDel, 0)
							.last("limit 1"));
					if (productAttrValue != null) {
						valueMap.put("id", productAttrValue.getId());
//						valueMap.put("image", productAttrValue.getImage());
//						if(StrUtil.isNotEmpty(productAttrValue.getImage())){
//							if(productAttrValue.getImage().indexOf("http") < 0){
//								productAttrValue.setImagePath(imgUrl + productAttrValue.getImage());
//								valueMap.put("imagePath", "");
//							}else{
//								productAttrValue.setImagePath(productAttrValue.getImage());
//								valueMap.put("imagePath", "");
//							}
//						}else{
//							valueMap.put("imagePath", "");
//						}
						valueMap.put("price", productAttrValue.getPrice());
						valueMap.put("cost", productAttrValue.getCost());
						valueMap.put("otPrice", productAttrValue.getOtPrice());
						valueMap.put("stock", productAttrValue.getStock());
//						valueMap.put("barCode", productAttrValue.getBarCode());
//						valueMap.put("weight", productAttrValue.getWeight());
//						valueMap.put("volume", productAttrValue.getVolume());
//						valueMap.put("brokerage", productAttrValue.getBrokerage());
//						valueMap.put("brokerageTwo", productAttrValue.getBrokerageTwo());
//						valueMap.put("pinkPrice", productAttrValue.getPinkPrice());
//						valueMap.put("pinkStock", productAttrValue.getPinkStock());

						valueMapList.add(ObjectUtil.clone(valueMap));
					}else{
						if(isReset == 1){
							valueMapList.add(ObjectUtil.clone(valueMap));
						}
					}
				}else{
					valueMapList.add(ObjectUtil.clone(valueMap));
				}
			}

			this.addMap(headerMap, headerMapList, align, isActivity);

			resultMap.put("attr", fromatDetailDTOList);
			resultMap.put("value", valueMapList);
			resultMap.put("header", headerMapList);

		}catch (Exception e){
			e.printStackTrace();
		}
		return resultMap;
	}

	/**
	 * 组合规则属性算法
	 *
	 * @param fromatDetailDTOList
	 * @return DetailDto
	 */
	private DetailDto attrFormat(List<FromatDetailDto> fromatDetailDTOList) {

		List<String> data = new ArrayList<>();
		List<Map<String, Map<String, String>>> res = new ArrayList<>();

		fromatDetailDTOList.stream().map(FromatDetailDto::getDetail)
			.forEach(i -> {
				if (i == null || i.isEmpty()) {
					throw new YshopException("请至少添加一个规格值哦");
				}
				String str = ArrayUtil.join(i.toArray(), ",");
				if (str.contains("-")) {
					throw new YshopException("规格值里包含'-',请重新添加");
				}
			});

		if (fromatDetailDTOList.size() > 1) {
			for (int i = 0; i < fromatDetailDTOList.size() - 1; i++) {
				if (i == 0) {
					data = fromatDetailDTOList.get(i).getDetail();
				}
				List<String> tmp = new LinkedList<>();
				for (String v : data) {
					for (String g : fromatDetailDTOList.get(i + 1).getDetail()) {
						String rep2 = "";
						if (i == 0) {
							rep2 = fromatDetailDTOList.get(i).getValue() + "_" + v + "-"
								+ fromatDetailDTOList.get(i + 1).getValue() + "_" + g;
						} else {
							rep2 = v + "-"
								+ fromatDetailDTOList.get(i + 1).getValue() + "_" + g;
						}

						tmp.add(rep2);

						if (i == fromatDetailDTOList.size() - 2) {
							Map<String, Map<String, String>> rep4 = new LinkedHashMap<>();
							Map<String, String> reptemp = new LinkedHashMap<>();
							for (String h : rep2.split("-")) {
								List<String> rep3 = Arrays.asList(h.split("_"));
								if (rep3.size() > 1) {
									reptemp.put(rep3.get(0), rep3.get(1));
								} else {
									reptemp.put(rep3.get(0), "");
								}
							}
							rep4.put("detail", reptemp);

							res.add(rep4);
						}
					}

				}

				if (!tmp.isEmpty()) {
					data = tmp;
				}
			}
		} else {
			List<String> dataArr = new ArrayList<>();
			for (FromatDetailDto fromatDetailDTO : fromatDetailDTOList) {
				for (String str : fromatDetailDTO.getDetail()) {
					Map<String, Map<String, String>> map2 = new LinkedHashMap<>();
					dataArr.add(fromatDetailDTO.getValue() + "_" + str);
					Map<String, String> map1 = new LinkedHashMap<>();
					map1.put(fromatDetailDTO.getValue(), str);
					map2.put("detail", map1);
					res.add(map2);
				}
			}
			String s = StrUtil.join("-", dataArr);
			data.add(s);
		}

		DetailDto detailDto = new DetailDto();
		detailDto.setData(data);
		detailDto.setRes(res);

		return detailDto;
	}


	/**
	 * 增加表头
	 *
	 * @param headerMap     headerMap
	 * @param headerMapList headerMapList
	 * @param align         align
	 */
	private void addMap(Map<String, Object> headerMap, List<Map<String, Object>> headerMapList, String align, boolean isActivity) {
//		headerMap.put("title", "图片");
//		headerMap.put("slot", "pic");
//		headerMap.put("align", align);
//		headerMap.put("minWidth", 80);
//		headerMapList.add(ObjectUtil.clone(headerMap));

		headerMap.put("title", "售价");
		headerMap.put("slot", "price");
		headerMap.put("align", align);
		headerMap.put("minWidth", 120);
		headerMapList.add(ObjectUtil.clone(headerMap));

//		headerMap.put("title", "成本价");
//		headerMap.put("slot", "cost");
//		headerMap.put("align", align);
//		headerMap.put("minWidth", 120);
//		headerMapList.add(ObjectUtil.clone(headerMap));

		headerMap.put("title", "原价");
		headerMap.put("slot", "otPrice");
		headerMap.put("align", align);
		headerMap.put("minWidth", 120);
		headerMapList.add(ObjectUtil.clone(headerMap));

		headerMap.put("title", "库存");
		headerMap.put("slot", "stock");
		headerMap.put("align", align);
		headerMap.put("minWidth", 120);
		headerMapList.add(ObjectUtil.clone(headerMap));

//		headerMap.put("title", "产品编号");
//		headerMap.put("slot", "barCode");
//		headerMap.put("align", align);
//		headerMap.put("minWidth", 120);
//		headerMapList.add(ObjectUtil.clone(headerMap));

//		headerMap.put("title", "重量(KG)");
//		headerMap.put("slot", "weight");
//		headerMap.put("align", align);
//		headerMap.put("minWidth", 120);
//		headerMapList.add(ObjectUtil.clone(headerMap));
//
//		headerMap.put("title", "体积(m³)");
//		headerMap.put("slot", "volume");
//		headerMap.put("align", align);
//		headerMap.put("minWidth", 120);

//		if (isActivity) {
//			headerMap.put("title", "拼团价");
//			headerMap.put("slot", "pinkPrice");
//			headerMap.put("align", align);
//			headerMap.put("minWidth", 120);
//			headerMapList.add(ObjectUtil.clone(headerMap));
//
//			headerMap.put("title", "拼团活动库存");
//			headerMap.put("slot", "pink_stock");
//			headerMap.put("align", align);
//			headerMap.put("minWidth", 120);
//			headerMapList.add(ObjectUtil.clone(headerMap));
//		}

		headerMap.put("title", "操作");
		headerMap.put("slot", "action");
		headerMap.put("align", align);
		headerMap.put("minWidth", 70);
		headerMapList.add(ObjectUtil.clone(headerMap));
	}
}
